<?php
defined('RUN_KATANA') or die('Restricted access');
if(substr_count($_SERVER['HTTP_HOST'], DOMAIN) == 0)
{ header('Location: '.SITE_URL.'commander/?'.$_SERVER['QUERY_STRING']); }
require(SITE_PATH.'includes/core/hc_site.php');
require(SITE_PATH.'includes/core/hc_loader.php');
require_once(MODEL_INCLUDE_PATH.'global/KatanaText.php');
require_once(MODEL_INCLUDE_PATH.'global/Email.php');
require_once(MODEL_INCLUDE_PATH.'global/Image.php');
require_once(MODEL_INCLUDE_PATH.'global/Google.php');
require_once(MODEL_INCLUDE_PATH.'global/Pager.php');
require('core/commander.php');
require('core/validator.php');
$site = getSiteSettings(1, 1);
$commander = new Commander();
/*
$result = mysql_query('SELECT value, '.LANG.' FROM '.DB_PERFIX.'words;');
while($row = mysql_fetch_array($result))
{ $words[$row['value']] = $row[LANG]; }
$commander->setWords($words);
*/
$txt 	= new KatanaText();
if(count($katana->getActiveCores()) > 0)
{
	foreach($katana->ActiveCores as $core) //Load Core Controller Classes
	{
		switch($core->getId())
		{
			case 1 : //Sitemap
				require_once(CONTROLLER_INCLUDE_PATH.$core->getHandle().'/'.$core->getControllerClass().'.php');
			break;
			case 2 : //Access Controller
				require_once(CONTROLLER_INCLUDE_PATH.$core->getHandle().'/'.$core->getControllerClass().'.php');
				$ac			= new $core->ControllerClass();
				$ac->setFrontend(1);
				$user		= new User(0);
			break;
			case 3 : //Form Manager
				require_once(CONTROLLER_INCLUDE_PATH.$core->getHandle().'/'.$core->getControllerClass().'.php');
			break;
			case 6 : //Advertise Controller
				require_once(CONTROLLER_INCLUDE_PATH.$core->getHandle().'/'.$core->getControllerClass().'.php');
			break;
			case 8 : //Shop
				require_once(CONTROLLER_INCLUDE_PATH.$core->getHandle().'/'.$core->getControllerClass().'.php');
			break;
			case 9 : //Survey
				require_once(KATANA_CORES_INCLUDE_PATH.$core->getControllerClass().'.php');
			break;
			case 10 : //Fleet
				require_once(KATANA_CORES_INCLUDE_PATH.$core->getControllerClass().'.php');
			break;
		}
	}
	
	foreach($katana->ActiveCores as $core)
	{
		switch($core->getId())
		{
			case 1 : //Sitemap
				$sitemap	= new $core->ControllerClass();
			break;
			case 2 : //Access Controller
				$ac			= new $core->ControllerClass();
				$user		= new User(0);
			break;
			case 3 : //Form Manager
				$fc			= new $core->ControllerClass();
			break;
			case 6 : //Advertise Controller
				$adc		= new $core->ControllerClass();
				$adc->setFrontend(0);
			break;
			case 8 : //Shop
				$shop = new $core->ControllerClass();
				$shop->setFrontend(0);
				$shop->setCoreHandle($core->getHandle());
			break;
			case 9 : //Survey
				//require_once(KATANA_CORES_INCLUDE_PATH.$core->getControllerClass().'.php');
				//$surveyCore = new SurveyCore();
				//Loading local com class
			break;
			case 10: //Fleet
				$fleet 		= new Fleet();
			break;
		}
	}
}
?>